@extends('admin.app')

@section('breadcrumb')
    <div class="bg-light lter b-b wrapper-md">
        <ol class="breadcrumb bg-light lter m-n no-padder">
            <li><a href="{{ admin_action('HomeController@index') }}">主页</a></li>
            <li>业务管理</li>
            <li class="{{ admin_action('Business\OrganizationalUserManagementController@index') }}">机构管理</li>
            <li class="active">部门管理</li>
        </ol>
    </div>
@endsection

@section('content')
    <div class="panel panel-default">
        <div class="panel-heading font-bold">
        {{ $user->organizationalInfo->company_name }}
        </div>
        <div class="row wrapper">
            <div class="col-sm-8">
               	<label class="text-danger">*机构部门不允许执行删除操作,如需强制删除,请移步<a style="text-decoration: underline;" href="{{ admin_action('System\CodesController@index',['DEPARTMENT']) }}">部门数据字典</a></label>
            </div>
            <div class="col-sm-4 text-right text-center-xs">
                <a class="btn m-b-xs btn-sm btn-default btn-addon"
                   href="{{ admin_action('Business\OrganizationalUserManagementController@createDept',[$user]) }}">
                    <i class="fa fa-plus"></i>新增一个部门
                </a>
            </div>
        </div>
        <div class="table-responsive">
            <table class="table table-striped b-t b-light">
                <thead>
                <tr>
                    <th>部门名称</th>
                    <th>部门简码</th>
                    <th>创建时间</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                @forelse ($deptList as $dept)
                    <tr>
                    	<td>{{$dept->name}}</td>
                    	<td>{{$dept->code}}</td>
                        <td>{{ $dept->created_at }}</td>
                        <td>
                           <!--  <a class="btn btn-xs btn-primary"
                               href="{{ admin_action('Business\OrganizationalUserManagementController@show', [$user]) }}"
                               data-toggle="tooltip" title="机构详情">
                                <i class="fa fa-info"></i>
                            </a> -->
                            <a class="btn btn-xs btn-primary"
                               href="{{ admin_action('Business\OrganizationalUserManagementController@agentList', [$user,$dept->code]) }}"
                               data-toggle="tooltip" title="查询下属人员">
                                <i class="fa fa-group"></i>
                            </a>
                           <!--  <a class="btn btn-xs btn-primary"
                               href="{{ admin_action('Business\OrganizationalUserManagementController@edit', [$user]) }}"
                               data-toggle="tooltip" title="编辑该用户">
                                <i class="fa fa-pencil"></i>
                            </a> -->
                           <!--  <form class="inline"
                                  action="{{ admin_action('Business\OrganizationalUserManagementController@destroy', [$user]) }}"
                                  method="post">
                                {{ csrf_field() }}
                                {{ method_field('DELETE') }}
                                <button type="button" data-swal-role="delete-confirm" data-swal-title="温馨提示"
                                        data-swal-text="您将删除机构用户 <{{ empty($user->userInfo->name)?$user->username:$user->userInfo->name }}>   "
                                        class="btn btn-xs btn-danger" data-toggle="tooltip" title="删除用户">
                                    <i class="fa fa-trash-o"></i>
                                </button>
                            </form> -->
                        </td>
                    </tr>
                @empty
                    <tr>
                        <td colspan="3" class="text-center">没有找到部门记录</td>
                    </tr>
                @endforelse
                </tbody>
            </table>
        </div>
        <div class="panel-footer">
            <div class="row">
                <div class="col-sm-12 text-right text-center-xs">
                    {!! $links !!}
                </div>
            </div>
        </div>
    </div>
@endsection